package sample.components
{
	import asf.interfaces.IInputField;
	
	import flash.geom.ColorTransform;
	
	import sample.viewassets.AInputField;

	public class InputField extends AInputField implements IInputField
	{
		public function InputField( )
		{
			super( );
		}
		
		public function markError( message:String ):void
		{
			var ct:ColorTransform = new ColorTransform( );
			ct.color = 0xFF0000;
			
			this.$bg.transform.colorTransform = ct;
		}
		
		public function clearError( ):void
		{
			this.$bg.transform.colorTransform = new ColorTransform( );
		}
		
		public function setMaxChars( value:int ):void
		{
			this.$input.maxChars = value;
		}
		
		public function setRestrict( value:String ):void
		{
			this.$input.restrict = value;
		}
		
		public function setPassword( value:Boolean ):void
		{
			this.$input.displayAsPassword = value;
		}
		
		public function dispose():void
		{
		}
		
		public function setValue( value:* ):void
		{
			this.$input.text = String( value );
		}
		
		public function getValue():*
		{
			return this.$input.text;
		}
		
		public function clearValue():void
		{
			this.$input.text = "";
		}
		
		public function focus():void
		{
		}
		
		public function blur():void
		{
		}
		
		public function setWidth(value:Number):void
		{
			width = value;
		}
		
		public function setHeight(value:Number):void
		{
			height = value;
		}
		
		public function getWidth():Number
		{
			return width;
		}
		
		public function getHeight():Number
		{
			return height;
		}
		
		public function setTabIndex(value:int):void
		{
			this.$input.tabIndex = value;
		}
		
		public function getTabIndex():int
		{
			return this.$input.tabIndex;
		}
		
		public function enable():void
		{
			this.mouseChildren = true;
			alpha = 1;
		}
		
		public function disable():void
		{
			this.mouseChildren = false;
			alpha = 0.5;
		}
		
		public function isValid():Boolean
		{
			return this.$input.text != "";
		}
		
		public function isEmpty( ):Boolean
		{
			return this.$input.text == "";
		}
	}
}